import myAxios from '@/utils/axios.js'
/**
 * 用户登录
 * @param {Object} data 登录数据模型 
 * @returns promise对象 
 */
export function userLogin(data) {
    let user = {
        user: data
    }
    return myAxios({
        url: '/users/login',
        method: 'post',
        data: user
    })
}
/**
 * 
 * @param {Object} data 用户注册对象
 * @returns 
 */
export function userRegister(data) {
    let user = {
        user: data
    }
    return myAxios({
        url: '/users',
        method: 'post',
        data: user
    })
}

/**
 * 
 * @param {Object} data 用户获取邮箱验证码
 * @returns 
 */
export function getEmailCode(data) {
    let user = {
        user: data
    }
    return myAxios({
        url: '/users/emailCode',
        method: 'post',
        data: user
    })
}

/**
 * 
 * @param {Object} data 用户重置密码
 * @returns 
 */
export function resetpwd(data) {
    let user = {
        user: data
    }
    return myAxios({
        url: '/users/verifyEmailCode',
        method: 'post',
        data: user
    })
}